package cn.ipanel.bigdata.utils

import scala.reflect.runtime.{universe => ru}

/**
 * Author: lzz
 * Date: 2022/4/6 18:06
 */
trait Ru {

  def clsInstance(pathname: String): Any = {
    val mirror = ru.runtimeMirror(getClass.getClassLoader)
    mirror.reflect(pathname).instance
  }

  def objInstance(pathname: String): Any = {
    val mirror = ru.runtimeMirror(getClass.getClassLoader)
    val module = mirror.reflectModule(mirror.staticModule(pathname))
    mirror.reflect(module.instance).instance
  }
}